home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / libelf / elf_getscn.z / elf_getscn
Encoding:
Text File  |  2002-10-03  |  4.2 KB  |  82 lines

  1. ELF_GETSCN(3E)                                       Last changed: 10-13-98
  2.  
  3.  
  4. NNAAMMEE
  5.      eellff__ggeettssccnn, eellff__nnddxxssccnn, eellff__nneewwssccnn, eellff__nneexxttssccnn - Get section
  6.      information
  7.  
  8. SSYYNNOOPPSSIISS
  9.      cccc [_f_l_a_g ...] _f_i_l_e ...  --lleellff [_l_i_b_r_a_r_y ...]
  10.  
  11.      ##iinncclluuddee <<lliibbeellff..hh>>
  12.  
  13.      EEllff__SSccnn **eellff__ggeettssccnn((EEllff **eellff,, ssiizzee__tt iinnddeexx));;
  14.  
  15.      ssiizzee__tt eellff__nnddxxssccnn((EEllff__SSccnn **ssccnn));;
  16.  
  17.      EEllff__SSccnn **eellff__nneewwssccnn((EEllff **eellff));;
  18.  
  19.      EEllff__SSccnn **eellff__nneexxttssccnn((EEllff **eellff,, EEllff__SSccnn **ssccnn));;
  20.  
  21. IIMMPPLLEEMMEENNTTAATTIIOONN
  22.      IRIX systems
  23.  
  24. DDEESSCCRRIIPPTTIIOONN
  25.      These functions provide indexed and sequential access to the sections
  26.      associated with the ELF descriptor, eellff.  If the program is building a
  27.      new file, it is responsible for creating the file's ELF header before
  28.      creating sections; see eellff__ggeetteehhddrr(3E).
  29.  
  30.      eellff__ggeettssccnn returns a section descriptor, given an iinnddeexx into the
  31.      file's section header table.  Note the first _r_e_a_l section has index 1.
  32.      Although a program can get a section descriptor for the section whose
  33.      iinnddeexx is 0 (SSHHNN__UUNNDDEEFF, the undefined section), the section has no data
  34.      and the section header is empty (though present).  If the specified
  35.      section does not exist, an error occurs, or eellff is null, eellff__ggeettssccnn
  36.      returns a null pointer.
  37.  
  38.      eellff__nneewwssccnn creates a new section and appends it to the list for eellff.
  39.      Because the SSHHNN__UUNNDDEEFF section is required and not interesting to
  40.      applications, the library creates it automatically.  Thus, the first
  41.      call to eellff__nneewwssccnn for an ELF descriptor with no existing sections
  42.      returns a descriptor for section 1.  If an error occurs or eellff is
  43.      null, eellff__nneewwssccnn returns a null pointer.
  44.  
  45.      After creating a new section descriptor, the program can use
  46.      eellff__ggeettsshhddrr to retrieve the newly created, clean section header.  The
  47.      new section descriptor will have no associated data [see
  48.      eellff__ggeettddaattaa(3E)].  When creating a new section in this way, the
  49.      library updates the ee__sshhnnuumm member of the ELF header and sets the
  50.      EELLFF__FF__DDIIRRTTYY bit for the section [see eellff__ffllaagg(3E)].  If the program is
  51.      building a new file, it is responsible for creating the file's ELF
  52.      header [see eellff__ggeetteehhddrr(3E)] before creating new sections.
  53.  
  54.      eellff__nneexxttssccnn takes an existing section descriptor, ssccnn, and returns a
  55.      section descriptor for the next higher section.  One may use a null
  56.      ssccnn to obtain a section descriptor for the section whose index is 1
  57.      (skipping the section whose index is SSHHNN__UUNNDDEEFF).  If no further
  58.      sections are present or an error occurs, eellff__nneexxttssccnn returns a null
  59.      pointer.
  60.  
  61.      eellff__nnddxxssccnn takes an existing section descriptor, ssccnn, and returns its
  62.      section table index.  If ssccnn is null or an error occurs, eellff__nnddxxssccnn
  63.      returns SSHHNN__UUNNDDEEFF.
  64.  
  65. EEXXAAMMPPLLEESS
  66.      The following is an example of sequential access.  Each pass through
  67.      the loop processes the next section in the file; the loop terminates
  68.      when all sections have been processed.
  69.  
  70.           scn = 0;
  71.           while ((scn = elf_nextscn(elf, scn)) != 0)
  72.           {
  73.                /* process section */
  74.           }
  75.  
  76. SSEEEE AALLSSOO
  77.      eellff(3E), eellff__bbeeggiinn(3E), eellff__ffllaagg(3E), eellff__ggeettddaattaa(3E),
  78.      eellff__ggeetteehhddrr(3E), eellff__ggeettsshhddrr(3E)
  79.  
  80.      This man page is available only online.
  81.  
  82.